/**
 * 全局工具类
 */
import router from "@/core/router";
import {TagsViewModule} from "@/core/store/modules/tags-view";
import {Component, Vue} from "vue-property-decorator";

@Component({
    name: 'Kit',
})
export default class Kit extends Vue {
    get beforeName() {
        return this.$route.query.beforeName
    }

    get beforeUrl() {
        return this.$route.query.beforeUrl
    }

    go(path: any = "", query: any = {}) {
        query.beforeName = this.$route.name;
        query.beforeUrl = this.$route.fullPath;
        if (path.toString().indexOf("/") != -1) {
            router.push({path: path, query: query});
        } else {
            router.push({name: path, query: query});
        }
    };

    back(url: any = "/", query: any = {}) {
        TagsViewModule.delViewByRoute(this.$route);
        router.push({path: url, query: query} as any);
    };

}
